package com.nf.health.app.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.nf.health.app.R;
import com.nf.health.app.customview.SwipeView;
import com.nf.health.app.models.DoctorVo;
import com.nf.health.app.utils.ImageLoaderUtils;

import java.util.ArrayList;
import java.util.List;

/*
*
* 私人医生
*/

public class PerDoctorAdapter extends BaseAdapter {

	protected static final String TAG = PerDoctorAdapter.class.getSimpleName();
	private Activity context;
	private List<DoctorVo> doctors;
	public ArrayList<SwipeView> unClosedSwipeView = new ArrayList<SwipeView>();

	public PerDoctorAdapter(Activity context, List<DoctorVo> doctors) {
		this.context = context;
		this.doctors = doctors;

	}

	@Override
	public int getCount() {
		if (doctors != null) {
			return doctors.size();
		}
		return 10;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		String isprivate = doctors.get(position).getIsprivate();
		ViewHolder holder = ViewHolder.get(parent, convertView, R.layout.item_my_doctor_per, position);
		ImageView iv_user_head_icon = holder.getView(R.id.iv_user_head_icon);
		ImageLoaderUtils.getinstance(context).getImage(iv_user_head_icon,doctors.get(position).getDoctorhimg(), R.drawable.moren_doctor_image);
//		TextView tv_unread_msg = holder.getView(R.id.tv_unread_msg);//消息数
//		String time[] = doctors.get(position).getTerendtime().split(" ");
//		holder.setText(R.id.doctor_time,time[0]);

		holder.setText(R.id.doctor_name, doctors.get(position).getDoctorname());
		holder.setText(R.id.doctor_riqi, "5天");
		holder.setText(R.id.doctor_speciality_details, doctors.get(position).getHospitalname()+" - "+doctors.get(position).getDepartment());
		return holder.getConvertView();
	}
}
